package com.examp.dy.dy.dao;

import com.examp.dy.dy.entities.Book;
import com.examp.dy.dy.entities.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface UserRepository extends JpaRepository<User,Long> {
    @Override
    List<User> findAll();

    User findByuserId(long userId);

    @Query(nativeQuery = true,value="SELECT s.name, s.wechat_id AS wechatId, COUNT(s.student_id) AS projectCount " +
            "FROM student AS s LEFT JOIN project_student AS ps ON s.student_id = ps.student_id " +
            "GROUP BY s.name, s.wechat_id ORDER BY 3 desc;")
    List<BloginfoUser> bloginfouser();
}
